<template>
    <div class="login">
        <div class="con">
            <div class="title">浙深供应链劳务派遣管理系统</div>
            <div class="box">
                <div class="l"><img src="../assets/img/com.png" alt=""></div>
                <div class="r">
                    <div class="r-title">密码登录</div>
                    <div class="div1"><input class="ipt1" type="text" v-model="username"  placeholder="请输入用户名"></div>
                    <div class="div2"><input class="ipt2" type="password" v-model="password" placeholder="请输入密码"></div>
                   <el-button @click="submit">登录</el-button>
                </div>
            </div>
        </div>
    </div>
</template>

<script scoped>
    import request from '@/utils/request'
    // import axios from 'axios'

//    const urlParams = 'http://192.168.0.102:6061'
   const urlParams = 'http://122.112.213.124:6061'


    export default {
        data() {
            return {
                username: "",
                password: "",
                // dialog: false,
            }
        },
        created(){
            
            // this.submit()
        },
        methods: {
            submit () {
                // const params = {
                //     username:this.username,
                //     password:this.password
                // }
                if(!this.username){
                    this.$message('请输入账号');
                }else if(!this.password){
                    this.$message('请输入密码');
                }else if(this.username != "admin"){
                    this.$message('账号不正确，请重新输入');
                }else if(this.password != "123456"){
                    this.$message('密码不正确，请重新输入');
                }else{
                    this.$axios({
                        method: 'post',
                        url: '/login',
                        params: {
                            username:this.username,
                            password:this.password
                        }
                        }).then(res=>{
                            console.log(res.data);
                            if(res.data.code = 203){
                                window.localStorage.setItem('token','Bearer '+ res.data.jwtToken)
                                this.$router.push('/Index')
                            }
                        },err=>{
                            console.log(err);
                    })
                }
               
            }
        
        }      
    }
  
</script>

<style>
h1, h2 {
  font-weight: normal;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
 text-decoration: none;
  color: #89bffd;
}
.login{
    width: 100%;
    height: 100%;
    min-height: 100vh;
    background: url('../assets/img/bc.png') no-repeat;
    background-size: 100%;
    overflow: hidden;
    /* padding-bottom: 164px; */
}
.con{
    width: 627px;
    margin: 164px auto;
}
.title{
    width: 672px;
    height: 40px;
    font-size: 40px;
    text-align: center;
    font-family: PingFangSC-Semibold, PingFang SC;
    font-weight: 600;
    color: #FFFFFF;
    line-height: 40px;
    text-shadow: 0px 1px 3px rgba(9, 39, 60, 0.24);
}
.box{
    width: 627px;
    height: 320px;
    background: #FFFFFF;
    box-shadow: 0px 5px 11px 0px rgba(9, 39, 60, 0.16);
    opacity: 0.94;
    border: 1px solid #015BA7;
    display: flex;
    margin-top: 43px;
}
.l{
    width: 267px;
    height: 320px;
    background: #000000;
    border-radius: 0px 0px 40px 0px;
}
.r{
    width: 360px;
    text-align: center;
}
.r-title{
    width: 96px;
    height: 33px;
    font-size: 24px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #000000;
    line-height: 33px;
    margin:42px 137px 27px 127px;
}
/* .div1,.div2{
    width: 253px;
    height: 40px;
} */
.ipt1,.ipt2{
    border: none;
    width: 253px;
    height: 40px;
    background: #FFFFFF;
    border: 1px solid #999999;
    padding-left: 10px;
}
.ipt1{
    margin-bottom: 20px;
}
.login .el-button{
    border: none;
    width: 253px;
    height: 33px;
    background: #000000;
    font-size: 13px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #FFFFFF;
    /* line-height: 33px; */
    /* text-align: center; */
    margin-top: 40px;
}
</style>